home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / admin / xinetd.2 / xinetd / xinetd.2.1.7-linux.4 / libs / src / misc / Makefile.freebsd < prev    next >
Encoding:
Makefile  |  1995-06-01  |  3.6 KB  |  149 lines

  1. # (c) Copyright 1992 by Panagiotis Tsirigotis
  2. # All rights reserved.  The file named COPYRIGHT specifies the terms 
  3. # and conditions for redistribution.
  4.  
  5. #
  6. # $Id: Makefile.freebsd,v 1.2 1995/06/01 01:18:34 chuck Exp $
  7. #
  8. # Based on Library makefile template: *Revision: 1.15 *
  9. #
  10.  
  11. # Available entries:
  12. #         lib             --> creates the library
  13. #        install        --> installs the library (archive, man page(s), header(s))
  14. #        uninstall    --> uninstall the library
  15. #        clean            --> removes all .o and .a files
  16. #        spotless        --> clean + uninstall
  17. #         lint            --> lints a file (usage: make lint MODULE=foo.c)
  18. #        tags            --> creates a tags file (from the SOURCES and HEADERS)
  19. #        checkout     --> checkout all files
  20. #        dist            --> distribution support
  21. #
  22.  
  23. NAME                = misc
  24. VERSION            = 1.2.2
  25.  
  26. HEADERS            = misc.h ftwx.h env.h
  27. SOURCES            = misc.c ftwx.c env.c cvt.c gcvt.c
  28. OBJECTS            = misc.o ftwx.o env.o cvt.o gcvt.o
  29.  
  30. MANFILES            = misc.3 ftwx.3 env.3
  31. INCLUDEFILES    = $(HEADERS)
  32.  
  33. # The following variables are used by the 'install' entry and
  34. # should be customized:
  35. #     LIBDIR:     where the library will be placed
  36. #     INCUDEDIR:  where the include files will be placed
  37. #     MANDIR:     where the man pages will be placed
  38. #
  39. LIBDIR            = $(HOME)/.links/libraries/$(ARCH)
  40. MANDIR            = $(HOME)/.links/manpages/man3
  41. INCLUDEDIR        = $(HOME)/.links/includes
  42.  
  43. #
  44. # Possible flags:
  45. #     -DOLD_DIR         : must include <sys/dir.h> instead of <dirent.h>
  46. #     -D__FTWX_NO_FTW   : does not have <ftw.h>
  47. #
  48. DEFS                =                # used for command line defined flags
  49.  
  50. DEBUG                = -g                # -g or -O
  51. VERSION_DEF        = -DVERSION=\"MISC\ Version\ $(VERSION)\"
  52.  
  53. CPP_DEFS            = $(VERSION_DEF) $(DEFS)
  54.  
  55. #
  56. # The following variables shouldn't need to be changed
  57. #
  58. LINT_FLAGS        = -hbux
  59. CPP_FLAGS        = $(CPP_DEFS)
  60. CC_FLAGS            = $(DEBUG)
  61. CFLAGS            = $(CPP_FLAGS) $(CC_FLAGS)
  62.  
  63. INSTALL            = install -c
  64. FMODE                = -m 640            # used by install
  65. RANLIB            = ranlib
  66.  
  67. PAGER                = less
  68.  
  69.  
  70. LIBNAME            = lib$(NAME).a
  71.  
  72. lib: $(LIBNAME)
  73.  
  74. libopt: clean
  75.     make DEBUG=-O lib
  76.     mv $(LIBNAME) $(LIBDIR)/optimized
  77.  
  78.  
  79. $(LIBNAME): $(OBJECTS)
  80.     ar r $@ $?
  81.     $(RANLIB) $@
  82.  
  83. lint:
  84.     lint $(CPP_FLAGS) $(LINT_FLAGS) $(MODULE) 2>&1 | $(PAGER)
  85.  
  86. install: $(LIBNAME)
  87.     @if test "$(LIBDIR)" -a "$(INCLUDEDIR)" -a "$(MANDIR)" ;\
  88.     then \
  89.         $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR) ;\
  90.         echo "Installed $(LIBNAME) to $(LIBDIR)" ;\
  91.         for i in $(INCLUDEFILES); do $(INSTALL) $(FMODE) $$i $(INCLUDEDIR) ; done ;\
  92.         echo Installed $(INCLUDEFILES) to $(INCLUDEDIR) ;\
  93.         for i in $(MANFILES) ; do $(INSTALL) $(FMODE) $$i $(MANDIR) ; done ;\
  94.         echo Installed $(MANFILES) to $(MANDIR) ;\
  95.     else \
  96.         echo "You forgot to set one of the following variables: LIBDIR,INCLUDEDIR,MANDIR" ;\
  97.     fi
  98.  
  99. uninstall:
  100.     a=`pwd` ; cd $(INCLUDEDIR) ;\
  101.     if test $$a != `pwd` ; then rm -f $(INCLUDEFILES) ; fi
  102.     a=`pwd` ; cd $(LIBDIR) ;\
  103.     if test $$a != `pwd` ; then rm -f $(LIBNAME) ; fi
  104.     a=`pwd` ; cd $(MANDIR) ;\
  105.     if test $$a != `pwd` ; then rm -f $(MANFILES) ; fi
  106.  
  107. clean:
  108.     rm -f $(OBJECTS) $(LIBNAME) core
  109.  
  110. spotless: clean uninstall
  111.  
  112. tags: $(SOURCES) $(HEADERS)
  113.     ctags -w $(SOURCES) $(HEADERS)
  114.  
  115. checkout:
  116.     co $(SOURCES) $(HEADERS) $(MANFILES)
  117.  
  118. #
  119. # Distribution section
  120. # This section contains the 2 targets for distribution support: dist, dirs
  121. # "dist" checks out all files to be distributed
  122. # "dirs" prints a list of directories to be included in the distribution.
  123. # These directories should have a Makefile with a "dist" target
  124. #
  125. DISTRIBUTION_FILES    = $(HEADERS) $(SOURCES) $(MANFILES) README
  126. DIRS                        =
  127.  
  128. dist:
  129.     -co -q $(DISTRIBUTION_FILES)
  130.  
  131. dirs:
  132.     @echo $(DIRS)
  133.  
  134. #
  135. # PUT HERE THE RULES TO MAKE THE OBJECT FILES
  136. #
  137. misc.o:        misc.h
  138. ftwx.o:        ftwx.h misc.h
  139. env.o:        env.h misc.h
  140.  
  141.  
  142. #
  143. # Test program
  144. #
  145. tt: tt.c $(LIBNAME)
  146.     $(CC) -g tt.c -o $@ $(LIBNAME) -L$(LIBDIR) -ltest
  147.  
  148.